public class Test {
    public static void main(String[] args) {//轮转数组
        int[] nums = {1,2,3,4,5,6,7};
        rotate(nums, 3);
    }

    public static void rotate(int[] nums, int k) {//思考
        int tmp = 0;
        while (k != 0) {
            tmp = nums[nums.length - 1];
            for (int i = nums.length - 1; i > 0; i--) {
                nums[i] = nums[i - 1];
            }
            nums[0] = tmp;
            k--;
        }
    }





    public static void main1(String[] args) {//消失的数字
        int[] nums = {9, 6, 4, 2, 3, 5, 7, 0, 1};
        System.out.println(missingNumber(nums));
    }
    public static int missingNumber(int[] nums) {
        for (int i = 0; i < nums.length - 1; i++) {//nums.length
            for (int j = 0; j < nums.length - 1 - i; j++) {
                if (nums[j] > nums[j + 1]) {
                    int tmp = nums[j];
                    nums[j] = nums[j + 1];
                    nums[j + 1] = tmp;
                }
            }
        }
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] + 1 != nums[i + 1]) {
                return nums[i] + 1;//思考
            }
        }
        return -1;
    }
}
